home *** CD-ROM | disk | FTP | other *** search
- sync on
- sync rate 60
-
- hide mouse
-
- autocam off
- randomize timer()
-
- color light 0, rgb(255, 255, 255)
-
- `overall position of last matrix
- global posX# = 0
- global posZ# = 0
-
- `-----------------------------------------------------------
- `ALTER THE FOLLOWING VARIABLE TO LOAD YOUR EXPORTED FILE
- `-----------------------------------------------------------
- filename$ = "matrix.gdb"
-
- `open the main file to find the files to load
- open to read 2 , filename$
-
- `number of db units wide the overall heightmap is
- global pixelsX# = 0
- global pixelsZ# = 0
-
- `read the total size in db units of x and z
- read float 2 , pixelsZ#
- read float 2 , pixelsX#
-
- `number in the X by Z grid of matrices
- ZMatrices = 0
- XMatrices = 0
- read long 2 , ZMatrices
- read long 2 , XMatrices
-
- `store a count so we can assign a unique matrix number
- count = 1
-
- `load all the matrices in the exported grid
- for z = 0 to ZMatrices-1
-
- lastZ# = 0
-
- for x = 0 to XMatrices-1
- read string 2, dbmName$
- read string 2, bmpName$
-
- lastZ# = LoadMatrix( count, dbmName$, bmpName$ )
- count = count + 1
- next x
-
- posX# = 0
- posZ# = posZ# - lastZ#
-
- next z
-
- close file 2
-
- `setup camera
- Make Camera 1
- SET CAMERA RANGE 1, 1, 8000
- position camera 1, 0, 400, 0
- point camera 1, 100, 0, -100
-
- `main loop
- repeat
-
- control camera using arrowkeys 1, 100, 10
-
- `show FPS and message
- text 10, 10, "FPS : " + str$(screen fps())
- text 10, 20, "ESC to exit"
- text 10, 30, "cp : " + str$( cp/1.0 )
-
- sync
- until escapekey()
-
- delete camera 1
-
- show mouse
-
- function LoadMatrix( matrixNumber, fileName$, textureName$ )
-
- `read the matrix file
- open to read 1 , fileName$
-
- `get the x and z tile values
- dimx = 0
- dimz = 0
- read long 1 , dimx
- read long 1 , dimz
-
- `get the db units x and z values
- sizeX# = 0
- sizeZ# = 0
- read float 1 , sizeX#
- read float 1 , sizeZ#
-
- `create matrix
- make matrix matrixNumber, sizeX#, sizeZ#, dimx , dimz
-
- position matrix matrixNumber, posX# , 0 , posZ#
-
- ! posX# = posX# + sizeX#
-
- `read in the height data
- for z = dimz to 0 step -1
- for x = 0 to dimx
- read float 1 , ht#
- set matrix height matrixNumber ,x , z, ht#
- next x
- next z
-
- close file 1
-
- `sort out the texture
- load image textureName$,matrixNumber
- prepare matrix texture matrixNumber,matrixNumber, dimx, dimz
-
- in=1
-
- for z=dimz-1 to 0 step -1
- for x=0 to dimx-1
- set matrix tile matrixNumber,x,z,in
- in = in + 1
- next x
- next z
-
- set matrix texture matrixNumber, 2, 0
-
- update matrix matrixNumber
-
- endfunction sizeZ#
-